package control;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import modelo.jugador.Jugador;
import vista.VistaInicio;
import vista.VistaSalida;


public class ControlSalida {
	
	private VistaSalida viewSalida;
	
	public ControlSalida(VistaSalida exit){
		viewSalida = exit;
		
		viewSalida.addAccionSalir(new salirProg());
		viewSalida.addAccionRestart(new restartProg());
	}

	
	private class salirProg implements ActionListener{
		@Override
		public void actionPerformed(ActionEvent e) {
			//Guardar al Jugador
			System.exit(0);
		}
	}
	
	private class restartProg implements ActionListener{
		@Override
		public void actionPerformed(ActionEvent e) {
			viewSalida.dispose();
			new ControlInicio(new Jugador(""), new VistaInicio());
			
		}
	}
	
}
